home *** CD-ROM | disk | FTP | other *** search
/ Cinema Studio: Frank Herrmann / Cinema Studio - Frank Herrmann.iso / tools / texturestudio / rexx / rotateplanetanim.tsrx < prev    next >
Text File  |  1995-03-25  |  4KB  |  157 lines

  1. /* TextureStudio ARexx script **************************************/
  2.  
  3. /* Allow commands to return results */
  4.  
  5. options results
  6.  
  7. /* On error, goto ERROR:. Comment out this line if you wish to */
  8. /* perform your own error checking. */
  9.  
  10. signal on error
  11.  
  12. /* BEGIN PROGRAM *************************************************/
  13.  
  14. /* Constants */
  15.  
  16. AXIS_SLANT = 12
  17.  
  18. address "TEXTURESTUDIO"
  19.  
  20. /* Bring TextureStudio's screen to the front */
  21.  
  22. SCREEN_FRONT
  23.  
  24. /* Stop input to windows */
  25.  
  26. GUI_BLOCK
  27.  
  28. /* Get user's texture path */
  29.  
  30. TEXTUREPATH_GET VAR 'texture_path'
  31.  
  32. /* Ask user to select gasgiant texture */
  33.  
  34. REQUEST_FILE PATHPART '"'texture_path'"' FILEPART '"GasGiant.itx"',
  35.     PATTERN '"#?.itx"' TITLE '"Select GasGiant texture"' VAR 'texture_file'
  36.  
  37. /* Ask user for destination path */
  38.  
  39. REQUEST_DIR PATHPART '"Ram:"' TITLE '"Select destination directory"',
  40.     VAR 'dest_path'
  41.  
  42. /* Ask user to select number of frames */
  43.  
  44. REQUEST_MESSAGE TEXT '"Select the number of frames"',
  45.     BUTTONTEXT '"75|50|25|10"' VAR 'selected'
  46.  
  47. select
  48.     when selected = 0 then no_frames = 10
  49.     when selected = 1 then no_frames = 75
  50.     when selected = 2 then no_frames = 50
  51.     when selected = 3 then no_frames = 25
  52. end
  53.  
  54. /* Open selected texture and flush out all others */
  55.  
  56. OPEN '"'texture_file'"' FLUSH
  57.  
  58. /* Set axis on slight slant */
  59.  
  60. AXIS_SET Y_ALIGNMENT AXIS_SLANT
  61.  
  62. /* Map image onto plane */
  63.  
  64. OBJECT_SET SPHERE
  65.  
  66. /* Render each frame */
  67.  
  68. do frame = 1 to no_frames
  69.     angle = ( (frame - 1) / no_frames) * 360 - 180
  70.  
  71.     /* Set axis z alignment */
  72.  
  73.     AXIS_SET Z_ALIGNMENT angle
  74.  
  75.     /* Render screen in background */
  76.  
  77.     RENDER TOBACK
  78.  
  79.     /* Save out renderscreen */
  80.  
  81.     dest_filepart = 'Frame' || (frame + 99) || '.HAM'
  82.     FILE_JOIN PATHPART '"'dest_path'"',
  83.         FILEPART '"'dest_filepart'"' VAR 'dest_file'
  84.  
  85.     RENDERSCREEN_SAVE FILE '"'dest_file'"' FORCE
  86. end
  87.  
  88. /* Allow input back to windows */
  89.  
  90. GUI_UNBLOCK
  91.  
  92. /* END PROGRAM ***************************************************/
  93.  
  94. exit
  95.  
  96. /* On ERROR */
  97.  
  98. ERROR:
  99.  
  100. /* If we get here, either an error occurred with the command's */
  101. /* execution or there was an error with the command itself. */
  102. /* In the former case, rc2 contains the error message and in */
  103. /* the latter, rc2 contains an error number. SIGL contains */
  104. /* the line number of the command which caused the jump */
  105. /* to ERROR: */
  106.  
  107. if datatype(rc2,'NUMERIC') == 1 then do
  108.     /* See if we can describe the error with a string */
  109.  
  110.     select
  111.         when rc2 == 103 then
  112.             err_string = "ERROR 103, "||,
  113.                 "out of memory at line "||SIGL
  114.         when rc2 == 114 then
  115.             err_string = "ERROR 114, "||,
  116.                 "bad command template at line "||SIGL
  117.         when rc2 == 115 then
  118.             err_string = "ERROR 115, "||,
  119.                 "bad number for /N argument at line "||SIGL
  120.         when rc2 == 116 then
  121.             err_string = "ERROR 116, "||,
  122.                 "required argument missing at line "||SIGL
  123.         when rc2 == 117 then
  124.             err_string = "ERROR 117, "||,
  125.                 "value after keywork missing at line "||SIGL
  126.         when rc2 == 118 then
  127.             err_string = "ERROR 118, "||,
  128.                 "wrong number of arguments at line "||SIGL
  129.         when rc2 == 119 then
  130.             err_string = "ERROR 119, "||,
  131.                 "unmatched quotes at line "||SIGL
  132.         when rc2 == 120 then
  133.             err_string = "ERROR 120, "||,
  134.                 "line too long at line "||SIGL
  135.         when rc2 == 236 then
  136.             err_string = "ERROR 236, "||,
  137.                 "unknown command at line "||SIGL
  138.         otherwise
  139.             err_string = "ERROR "||rc2||" at line "||SIGL
  140.         end
  141.         end
  142. else if rc2 == 'RC2' then do
  143.     err_string = "ERROR in command at line "||SIGL
  144.     end
  145. else do
  146.         err_string = rc2||", line "||SIGL
  147.         end
  148.  
  149. say err_string
  150.  
  151. /* Unblock windows, just incase they are still blocked by the program being */
  152. /* terminated mid-way */
  153.  
  154. GUI_UNBLOCK
  155.  
  156. exit
  157.